package com.wd.base.component;

import java.util.HashMap;

/**
 * 组件初始化 服务<BR>
 *
 * @author w4425
 * @version [V1.0.0, 2021/4/20]
 * @since V1.0.0
 */
public class ComponentsService {
    private static HashMap<AppConfig.PAGE_TYPE, IAppComponent> mAppComponentMap = new HashMap<>();

    /**
     * 组件初始化时都注册到这个服务里面
     *
     * @param componentName
     * @param iAppComponent
     */
    public static void setAppComponent(AppConfig.PAGE_TYPE componentName, IAppComponent iAppComponent) {
        mAppComponentMap.put(componentName, iAppComponent);
    }

    public static IAppComponent getAppComponent(AppConfig.PAGE_TYPE componentName) {
        if (mAppComponentMap.containsKey(componentName)) {
            return mAppComponentMap.get(componentName);
        }
        return null;
    }
}
